import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'
import { ContractsService } from './contracts.service'
import { ApiTags } from '@nestjs/swagger'
import { BaseController } from '@/base/base.controller'
import { Contracts } from '@prisma/client'
import { ContractDto } from './dto/contract.dto'
import { ChangeStatusDto } from './dto/change-status-dto'

@ApiTags('委托')
@Controller('contracts')
export class ContractsController extends BaseController<Contracts, ContractDto> {
  constructor(private readonly contractsService: ContractsService) {
    super(contractsService)
  }

  @Patch('/status/:id')
  async changeStatus(@Param('id') id: string, @Body() dto: ChangeStatusDto) {
    return await this.contractsService.changeStatus(id, dto.status)
  }
}
